# -*- coding: UTF-8 -*-
"""
@author: tgy
@file: demo01.py
@time: 2021/01/27
"""
class Obj:
    y = 20


class MyMetaclass(type):
    ...
    def __call__(self, *args, **kwargs):
        ...
        obj = self.__new__(self)
        obj.__init__(*args,**kwargs)
        return obj

class Person(Obj,metaclass=MyMetaclass):
    x = 10
    def __init__(self):
        ...
        # self.x = 20

    def __add__(self, other):
        return self.x + other.x


if __name__ == '__main__':
    pass
    print(Person.y)
    print(Person.x)
    p = Person()
    print(dir(Person))
    print(Person.__dict__.keys())
    print(dir(p))
    p.y = 19
    print(p.x)
    print(p.y)
    print(p.__class__)
    print(p.__dict__)
    print(Person.__bases__)